<script type="text/javascript" charset="utf-8">
        $('.rules_all').on('ifChecked',function(){
            $(this).closest('.auth').find('input').iCheck('check');
        });
        $('.rules_all').on('ifUnchecked',function(){
            $(this).closest('.auth').find('input').iCheck('uncheck');
        });
        $('.rules_child').on('ifChecked',function(){
            $(this).closest('.auth-level1').find('input').iCheck('check');
        });
        $('.rules_child').on('ifUnchecked',function(){
            $(this).closest('.auth-level1').find('input').iCheck('uncheck');
        });
</script>
<div class="bjui-pageContent">
    <form action="{:U(writeGroup)}" class="pageForm" data-toggle="validate">
        <input type="hidden" name="closeCurrent" value="true"  />
        <input type="hidden" name="tabid" value="{$Think.const.CONTROLLER_NAME}"  />
        <input type="hidden" id="id" name="id" value="{$id}" >
        <div class="container-fluid" style="overflow:hidden;">
            <div class="row">
                <div class="col-xs-12">
                    <fieldset style="margin:10px;">
                        <legend>{$this_group['title']}--访问授权</legend>
                        <volist name="list" id="node" >
                        <div class="auth">
                            <div class="auth-level">
                                <label class="checkbox">
                                <input type="checkbox" class="rules_all" name="rules[]"  value="<?php echo $main_rules[$node['url']] ?>" data-toggle="icheck"  data-label="{$node.name}" <?php if (in_array($main_rules[$node['url']],$grouplist)): ?>
                                  checked
                                <?php endif ?>>
                                </label>

                            </div>
                                <present name="node['operator']">
                                <volist name="node['operator']" id="child" >
                                    <div class="auth-level1">
                                            <label class="checkbox">
                                           <input type="checkbox" class="rules_child" name="rules[]"  value="<?php echo $main_rules[$child['url']] ?>" data-toggle="icheck"  data-label="{$child.name}" <?php if (in_array($main_rules[$child['url']],$grouplist)): ?>
                                  checked
                                <?php endif ?>>
                                            </label>
                                       <notempty name="child['operator']">
                                           <div class="auth-level2">
                                               <volist name="child['operator']" id="op">
                                               <span>
                                                   <label class="checkbox">
                                                       <input type="checkbox" name="rules[]"  value="<?php echo $main_rules[$op['url']] ?>" data-toggle="icheck"  data-label="{$op.name}" <?php if (in_array($main_rules[$op['url']],$grouplist)): ?>
                                  checked
                                <?php endif ?>>
                                                   </label>
                                                   </span>
                                               </volist>
                                           </div>
                                       </notempty>
                                    </div>
                                </volist>
                                </present>
                        </div>
                    </volist>
                    </fieldset>
                </div>
            </div>
        </div>
    </form>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close">关闭</button></li>
        <li><button type="submit" class="btn-default">保存</button></li>
    </ul>
</div>